<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AddSysTypeToPayHistory extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('open_shop_sign_order_pay_history', function (Blueprint $table) {
            $table->unsignedInteger('sysType')->default(0)->comment('业务类型 详见CheckEnum')->after('type');
            $table->string('bizId', 64)->default('')->comment('业务订单号')->after('sysType');
        });

        \App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderPayHistoryModel::query()->update([
            'sysType' => \App\Enums\Check\CheckEnum::SYS_TYPE_OPEN_SHOP_LEAGUE,
            'bizId'   => \Illuminate\Support\Facades\DB::raw('orderNo')
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('open_shop_sign_order_pay_history', function (Blueprint $table) {
            $table->dropColumn('sysType');
        });
    }
}
